package Collection1;

import java.util.ArrayList;
import java.util.Collection;

public class Collection2 {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        c.add("apple");
        c.add("banana");
        c.add("orange");
        //集合转为字符串数组
        Object[] arr = c.toArray();
        System.out.println(arr.toString());

        String[] arr2 = c.toArray(String[]::new);
        String[] arr3 = c.toArray(new String[0]);
    }
}
